#include "head.h"
#define ARRAY_LEN(arr) (sizeof(arr) / sizeof((arr)[0])) // 计算数组长度的宏定义
// 模块1：演示基本数据类型和运算符
int demonstrate_basic_operations(int a, int b)
{
    //printf("%d + %d = %d\n", a, b, a + b);
    return a + b;
}

// 模块2：演示指针操作
int demonstrate_pointer_operations(int *ptr)
{
    int a = 10;
    ptr = &a;
    //printf("Pointer value: %d\n", *ptr);
    return *ptr;
}

// 模块3：演示数组和指针
int demonstrate_array_and_pointer(int arrs[5],int *ptr)
{
    ptr = arrs;
    return *(ptr + 2);
    // printf("Array element via pointer: %d\n", *(numbers + 2));
}

// 模块4：演示条件判断和循环
void demonstrate_conditions_and_loops()
{
    int a = 10;
    if (a > 5)
    {
        printf("a is greater than 5\n");
    }

    int numbers[] = {1, 2, 3};
    for (int i = 0; i < ARRAY_LEN(numbers); i++)
    {
        printf("Number %d: %d\n", i, numbers[i]);
    }
}

// 模块5：演示指针数组
char* demonstrate_pointer_array(char *names[3])
{
    names[0] = "Tom";
    names[1] = "Jerry";
    names[2] = "Spike";
    return names[0];
}

void show(char *str)
{
    printf("%s\n", str);
}